﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="group_personal_edit.aspx.cs" Inherits="Ccit.OA.Group.group_personal_edit" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
     <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/StringClass_Ext.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script type="text/javascript">
        function doSave(oType)
        {
            var name = document.getElementById("txtName").value;
            if(name.Trim()!="")
            {
                  var MsGroup = {};
                  MsGroup.GroupType=document.getElementById("_hidType").value;
                  MsGroup.ID = document.getElementById("_hidsRecId").value;
                  MsGroup.GroupName = name;
                  var jsonExpr = JSON.stringify(MsGroup,function(key,value){return value;}); 
                      msAddBook = null; 
                    PageMethods.DoSaveMes(jsonExpr,oType,ClientCallBack);     
            }
            else
            {                
                alert("分组名称不能为空!")
                document.getElementById("txtName").focus();
            }
        }
        function ClientCallBack(vResult)
          {
                eval("resultObj ="+vResult)
                if(resultObj.result!="-999")
                {
                    alert(resultObj.message);
                     var isAddNew = ($get("_hidsRecId").value == "") ? "0" : "1";  //是否是新增记录标志  0:是 1:否 
                    switch(resultObj.ctrtype){
                         case "1":
                            $get("_hidsRecId").value = resultObj.result; 
                            document.getElementById("txtName").focus();
                            break;
                         case "2":   
                            doClear();
                            document.getElementById("txtName").focus();
                            break;
                         case "3":
                            doBack();
                            break;
                         case "4":                            
                            break;
                    }
                      var curColObj = {};
                        curColObj.groupId = resultObj.result;
                        curColObj.groupname = resultObj.groupname; 
                        var jsonExpr=JSON.stringify(curColObj,function(key,value){return value;});
                        parent.frames[0].document.getElementById("_hidNewColumnId").value=jsonExpr;
                    //parent.frames[1].document.getElementById("_hidGroupId").value = resultObj.result; //此处与获取_hidUpDeptId值应一样               
                    parent.frames[0].document.getElementById("_hidAddNewSign").value = isAddNew;  //新增记录标志
                    parent.frames[0].document.all.btnTrigger.click();    
                }
                else
                {
                    alert(resultObj.message)
                }
                resultObj = null;
          }
          function doBack()
          { 
                var groupId = document.getElementById("_hidsRecId").value;
                var organPageParam="GroupId="+groupId;     
                var organEncodeParam=base64encode(organPageParam);
                var URL = "group_personal_list.aspx?"+organEncodeParam;
                parent.frames[1].document.location.href= URL;
                var strURL = "group_personal_list.aspx";
                document.location.href = strURL;
          }
          function doClear()
          {
             document.getElementById("_hidsRecId").value = "";
             document.getElementById("txtName").value=""; 
          }
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">
     <input type="hidden" id="_hidsRecId" runat="server" />
     <input type="hidden" id="_hidType" runat="server" />
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager> 
        <table cellpadding="0" class="tableborder" cellspacing="0" width="98%" align="center" id="tdMessage" runat="server">
           <tr>
            <td align="right" width="10%" class="pformleft">分组名称</td>
            <td width="20%" class="pformright">
                <asp:TextBox  ID="txtName" Runat="server" CssClass="input" Width="98%" MaxLength="40"></asp:TextBox>
            </td>
            </tr>
            <tr class="pformstrip" height="20">
           <td colspan="2" align="center">
                <input type="button" id="btnSave" value="保存" class="button" onclick="doSave('1')" />
                &nbsp;
                <input type="button" id="btnSaveCont" value="保存并新增" class="button" onclick="doSave('2')" />
                &nbsp;
                <input type="button" id="btnSaveBack" value="保存并返回" class="button" onclick="doSave('3')" />
                &nbsp;  
                <input type="button" id="btnBack" value="返回" class="button" onclick="doBack()" />
                &nbsp;
            </td>
        </tr>
        </table>
    </ccit:ActionForm>
</body>
</html>
